﻿using System;


namespace HAVNet.Intros.AST
{
    public class ASTEmbStmtGoto : ASTEmbStmt
    {
        //  "goto"
        //  (   ident
        //  |   "case"
        //      Expression<out expr>
        //  |   "default"
        //  )
        //  ";"

        public string   ident       { get; set; }
        public ASTExpr  expression  { get; set; }

        public override string ToString ()
        {
            if (! string.IsNullOrEmpty(ident))
                return "goto " + ident + ";";
            else if (expression != null)
                return "goto case " + expression.ToString() + ";";
            else
                return "goto default;";
        }
    }
}
